<:!:/><!--
/**
 * @file c.resetuser.html
 * @author Alejandro Dario Simi
 * @date $Date: 2013-08-22 23:54:04 +0000 (Thu, 22 Aug 2013) $
 *
 * $Id: c.resetuser.html 103 2013-08-22 23:54:04Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/tags/wcomix-1.0/themes/default/templates/contents/c.resetuser.html $
 */
--><::/>
<script type="text/javascript">
	function RenewCaptcha() {
		$("#imgcaptcha").attr("src", "<:VAR:/>CAPTCHA-URI<::/>/securimage_show.php?" + Math.random());
		$("#CAPTCHA").val("");
	}
	function RequestUsername () {
		var email = $("#U_EMAIL").val().trim();
		var captcha = $("#CAPTCHA").val();
		if(captcha.length > 0 && email.length > 0) {
			jQuery.post('service.php?action=<:VAR:/>WC_SERVICE_USERS<::/>', {
						'MODE':		'getusername',
						'EMAIL':	email,
						'CAPTCHA':	captcha
					}, function(data){
				var	xml = $($.parseXML(data));
				if(xml.find("wc-success").length) {
					alert("An e-mail was sent to '"+email+"'.\nPlease check your e-mail inbox.");
					ReloadHome();
				} else if(xml.find("wc-failed").length) {
					var	error = "";
					if(xml.find("wc-error>wc-code").length) {
						error = "[" + xml.find("wc-error>wc-code").text() + "] ";
					}
					error = error + xml.find("wc-error>wc-message").text();

					RenewCaptcha();
					alert("Failed: " + error);
				}
			});
		} else if(captcha.length == 0) {
			$("#CAPTCHA").focus();
			alert("You must complete the captcha with the right answer");
		} else {
			$("#U_EMAIL").focus();
			alert("You must enter an e-mail address");
		}
	}
	function RequestPassword () {
		var username = $("#P_USERNAME").val().trim();
		var email = $("#P_EMAIL").val().trim();
		var captcha = $("#CAPTCHA").val();
		if(captcha.length > 0 && username.length > 0 && email.length > 0) {
			jQuery.post('service.php?action=<:VAR:/>WC_SERVICE_USERS<::/>', {
						'MODE':		'getpassword',
						'USERNAME':	username,
						'EMAIL':	email,
						'CAPTCHA':	captcha
					}, function(data){
				var	xml = $($.parseXML(data));
				if(xml.find("wc-success").length) {
					alert("An e-mail was sent to '"+email+"'.\nPlease check your e-mail inbox.");
					ReloadHome();
				} else if(xml.find("wc-failed").length) {
					var	error = "";
					if(xml.find("wc-error>wc-code").length) {
						error = "[" + xml.find("wc-error>wc-code").text() + "] ";
					}
					error = error + xml.find("wc-error>wc-message").text();

					RenewCaptcha();
					alert("Failed: " + error);
				}
			});
		} else if(captcha.length == 0) {
			$("#CAPTCHA").focus();
			alert("You must complete the captcha with the right answer");
		} else if(username.length == 0) {
			$("#P_USERNAME").focus();
			alert("You must enter an username");
		} else {
			$("#P_EMAIL").focus();
			alert("You must enter an e-mail address");
		}
	}
</script>
<form id="UsernameForm" class="Formulary" action="#" onsubmit="RequestUsername();return false;" method="post">
	<table><tr>
		<td class="Title" colspan="2"><span class="Title">Request Username</span></td>
	</tr><tr>
		<td class="Info" colspan="2"><p>
			If you don't remember your username, you may use this form
			to request it.
		</p></td>
	</tr><tr>
		<td class="Label">e-mail</td>
		<td class="Value"><input class="Full" type="text" id="U_EMAIL" value=""/></td>
	</tr><tr>
		<td colspan="2" class="Buttons">
			<input type="submit" value="Send"/>
		</td>
	</tr></table>
</form>
<form id="PasswordForm" class="Formulary" action="#" onsubmit="RequestPassword();return false;" method="post">
	<table><tr>
		<td class="Title" colspan="2"><span class="Title">Request Password</span></td>
	</tr><tr>
		<td class="Info" colspan="2"><p>
			If you lost you password, you may use this form to request
			a password reset.
		</p></td>
	</tr><tr>
		<td class="Label">Username</td>
		<td class="Value"><input class="Full" type="text" id="P_USERNAME" value=""/></td>
	</tr><tr>
		<td class="Label">e-mail</td>
		<td class="Value"><input class="Full" type="text" id="P_EMAIL" value=""/></td>
	</tr><tr>
		<td colspan="2" class="Buttons">
			<input type="submit" value="Send"/>
		</td>
	</tr></table>
</form>
<form class="Formulary" action="#" onsubmit="return false;" method="get">
	<table><tr>
		<td class="Info" colspan="2"><p>
			This CAPTCHA image is required for any of the forms above. Nevertheless, you must press the right sending button.
		</p></td>
	</tr><tr>
		<td class="Label" rowspan="3" style="vertical-align:top;">Captcha</td>
		<td class="Value" style="text-align:center;">
			<img id="imgcaptcha" class="center" src="<:VAR:/>CAPTCHA-URI<::/>/securimage_show.php" alt="CAPTCHA Image"/>
		</td>
	</tr><tr>
		<td class="Value">
			<input type="button" class="FullButton" value="Get another code" onclick="RenewCaptcha();return false;"/>
		</td>
	</tr><tr>
		<td class="Value">
			<input type="text" id="CAPTCHA" class="Full"/>
		</td>
	</tr></table>
</form>